from TextBadger.models import *
from xml.dom.minidom import parse
from django.conf import settings
import sys

def generate(report):
        return True

reports = Report.objects.filter(status=2)

for report in reports:
	report.status=3
	report.save()

for report in reports:
	print report.id
	
	try:
		r = generate(report)
		if r == True:
			report.status = 1
			report.save()
		else:
                        report.status = 4
                        report.save()
	except:
		print sys.exc_type, ":", sys.exc_value
		print 'Encountered Error'
		report.status = 4
		report.save()

